package com.shsh.safemanage.model;

import java.util.Calendar;

import com.shsh.safemanage.util.Constants;

public class Problem {
	private Long id;
	private String problemTitle;
	private String problemContent;
	private String problemZhenggai;
	private Long department1ID;
	private String department1Name;
	private Long equipmentID;
	private String equipmentName;
	private Long writeUserID;
	private Calendar writeTime;
	private int processStatus;
	private String writeUserName;
	private Long transferID;
	private Long closeUserID;
	private Calendar closeTime;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getProblemTitle() {
		return problemTitle;
	}

	public void setProblemTitle(String problemTitle) {
		this.problemTitle = problemTitle;
	}

	public String getProblemContent() {
		return problemContent;
	}

	public void setProblemContent(String problemContent) {
		this.problemContent = problemContent;
	}

	public String getProblemZhenggai() {
		return problemZhenggai;
	}

	public void setProblemZhenggai(String problemZhenggai) {
		this.problemZhenggai = problemZhenggai;
	}

	public Long getDepartment1ID() {
		return department1ID;
	}

	public void setDepartment1ID(Long department1id) {
		department1ID = department1id;
	}

	public Long getEquipmentID() {
		return equipmentID;
	}

	public void setEquipmentID(Long equipmentID) {
		this.equipmentID = equipmentID;
	}

	public Long getWriteUserID() {
		return writeUserID;
	}

	public void setWriteUserID(Long writeUserID) {
		this.writeUserID = writeUserID;
	}

	public Calendar getWriteTime() {
		return writeTime;
	}

	public void setWriteTime(Calendar writeTime) {
		this.writeTime = writeTime;
	}

	public int getProcessStatus() {
		return processStatus;
	}

	public void setProcessStatus(int processStatus) {
		this.processStatus = processStatus;
	}

	public String getWriteUserName() {
		return writeUserName;
	}

	public void setWriteUserName(String writeUserName) {
		this.writeUserName = writeUserName;
	}

	public String getDepartment1Name() {
		return department1Name;
	}

	public void setDepartment1Name(String department1Name) {
		this.department1Name = department1Name;
	}

	public String getEquipmentName() {
		return equipmentName;
	}

	public void setEquipmentName(String equipmentName) {
		this.equipmentName = equipmentName;
	}
	
	public Long getTransferID() {
		return transferID;
	}

	public void setTransferID(Long transferID) {
		this.transferID = transferID;
	}

	public Calendar getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(Calendar closeTime) {
		this.closeTime = closeTime;
	}

	public Long getCloseUserID() {
		return closeUserID;
	}

	public void setCloseUserID(Long closeUserID) {
		this.closeUserID = closeUserID;
	}

	public boolean equals(Object o) {
		if (o == null) {
			return false;
		}
		
		if (!(o instanceof Problem)) {
			return false;
		}
		
		Problem problem = (Problem) o;
		return this.id.equals(problem.getId());
	}
	
	public int hashCode() {
		return this.id.intValue();
	}
	
	public int nextStatus(int next) {
		if (this.getProcessStatus() == Constants.PROBLEM_STATUS_OPEN) {
			if (next > 0) {
				return Constants.PROBLEM_STATUS_ZUZHANG_ZHUANGZHIZHANG;
			} else {
				return Constants.PROBLEM_STATUS_OPEN;
			}
		} else if (this.getProcessStatus() == Constants.PROBLEM_STATUS_ZUZHANG_ZHUANGZHIZHANG) {
			if (next > 0) {
				return Constants.PROBLEM_STATUS_ANQUANZONGJIAN_FUBUZHANG;
			} else {
				return Constants.PROBLEM_STATUS_ZUYUAN;
			}
		} else if (this.getProcessStatus() == Constants.PROBLEM_STATUS_ANQUANZONGJIAN_FUBUZHANG) {
			if (next > 0) {
				return Constants.PROBLEM_STATUS_BUZHANG;
			} else {
				return Constants.PROBLEM_STATUS_ZUZHANG_ZHUANGZHIZHANG;
			}
		} else if (this.getProcessStatus() == Constants.PROBLEM_STATUS_BUZHANG) {
			if (next > 0) {
				return Constants.PROBLEM_STATUS_BUZHANG;
			} else {
				return Constants.PROBLEM_STATUS_ANQUANZONGJIAN_FUBUZHANG;
			}
		}
		
		return Constants.PROBLEM_STATUS_OPEN;
	}
}
